package com.goods.shop.util;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class TimeUtils {
    public static String formatter(LocalDateTime time){
        DateTimeFormatter formatter=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        return formatter.format(time);
    }

    public static String formatterPattern(LocalDateTime time,String pattern){
        DateTimeFormatter formatter=DateTimeFormatter.ofPattern(pattern);
        return formatter.format(time);
    }
    public static String formatterDate(LocalDateTime time){
        DateTimeFormatter formatter=DateTimeFormatter.ofPattern("yyyyMMdd");
        return formatter.format(time);
    }
    public static String formatterTime(LocalDateTime time){
        DateTimeFormatter formatter=DateTimeFormatter.ofPattern("HHmmss");
        return formatter.format(time);
    }
}
